In designing an XML schema, it is often desirable to define one or more environment-specific base types. As used herein, the term “environment-specific base type” refers to a static type for use in a particular environment. The term “environment” refers to a programming domain, such as SQL server, c++, etc. Different programming domains typically have their own type systems.
Often, when moving data to XML, environment-specific type information is simply thrown away. For example, if data is being exported from Microsoft SQL Server, and the type of the data is NVARCHAR(256) in the SQL_Latin1_General_Cp437_BIN collection, the output schema might simply specify the output type information as xsd:string. In this case, the recipient of such a result would not have any type information available in order to apply environment-specific processing to the data, and would not, for example, be able to properly maintain the sort order for the data when it is displayed in a list with other data. Alternatively,  the data might be exported with type annotations. In this case, it might be typed as xsd:string, and an additional annotation of sqltypexsd:sqltypedecl=“NVARCHAR(256) SQL_Latin1_General_Cp437_BIN” might be added. The problem with this is that it creates two separate, parallel type systems, and does not describe the types using a derivation system such that behavior associated with a base type can be inherited by derived types. Another option would be to define a set of static XML type which describe all possible environment-specific types. The problem with this is that the set of all possible environment-specific types is enormous, and attempting to define and communicate a static set of all such types would be prohibitively expensive. For example, consider if NVARCHAR can have lengths between 1 and 4096, and if there were 32 known collations. In this case, there would be 4096×32=131,072 distinct type permutations for NVARCHAR alone.
It would be desirable, therefore, if there were available XML schema designs for environment-specific types based on base types.